CC = gcc
SRC = $(wildcard *.c)
LFLAG = -o
FLAG = -c
RM = rm -f
OBJ = $(SRC:.c=.o)#中间不要有空格
#此时SRC和OBJ都是文件列表了
$(BIN):$(OBJ)
	@$(CC) $(LFLAG) $@ $^
	@echo "linking ... $^ to $@"
%.o:%.c
	@$(CC) $(FLAG) $<
	@echo "comping ... $< to $@"
.PHONY:clean
clean:
	${RM} ${BIN} ${OBJ}



#.PHONY:test
#test:
#	@echo "${BIN}"









#code:code.o
#	gcc code.o -o code
#code.o:code.s
#	gcc -c code.s -o code.o
#code.s:code.i
#	gcc -S code.i -o code.s
#code.i:code.c
#	gcc -E code.c -o code.i
#.PHONY:clean
#clean:
#	rm -f code.i code.o code code.s



#code:code.c
#	gcc code.c -o code
#.PHONY:clean
#clean:
#	rm -f code

